angular.module('yanzheng' , []).controller('YzCtrl' , function ($rootScope,$scope) {
	
	$scope.sss = true;
	
	//判断是否存在这个数组,加入没有就创建一个;
	if (!$rootScope.Array) {
		$rootScope.Array = [];
	}
	
	if (localStorage.name != '' && localStorage.pass != '') {
		$rootScope.Array.push([localStorage.name || '',localStorage.pass || '']);
	}
	
	
	//正则
	var Reg1 = /^1[3578]\d{9}$/;  //手机号验证
	var Reg2 = /^\w{6,14}$/;      //密码
	
	$('aside .one').on('click' , function () {
		if (Reg1.test($('input').eq(0).val()) && Reg2.test($('input').eq(1).val())) {
			localStorage.name = $('input').eq(0).val();
			localStorage.pass = $('input').eq(1).val();
			$scope.sss = false;
		} else {
			alert('您的账号或密码有误');
			$('input').eq(0).val('');
			$('input').eq(1).val('');
		}
		
	})
//		$('input').eq(0).val(localStorage.name || '');
//		$('input').eq(1).val(localStorage.pass || '');

	
	$scope.dl = function () {
		
		console.log($rootScope.Array)
		
	}
	
})
